<template>
  <div class="service">
    <el-tabs v-model="activeName" style="height: 100%;" @tab-click="handleClick" type="border-card">
      <!-- <el-tab-pane style="height: 100%;" label="时长服务" name="first">
        <Duration ref="firstMethod"/>
      </el-tab-pane> -->
      <el-tab-pane style="height: 100%;" label="泊链车场月租" name="second">
        <Monthly ref="secondMethod"/>
      </el-tab-pane>
      <!-- <el-tab-pane style="height: 100%;" label="云盒服务" name="third">
        <CloudBox ref="thirdMethod"/>
      </el-tab-pane> -->
      <el-tab-pane style="height: 100%;" label="预约服务" name="four">
        <Appointment ref="fourMethod"/>
      </el-tab-pane>
      <el-tab-pane style="height: 100%;" label="非泊链车场月租" name="five">
        <Daoer ref="fiveMethod"/>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import Duration from './duration/index.vue'
import Monthly from './monthly/index.vue'
import CloudBox from './cloudbox/index.vue'
import Appointment from './appointment/index.vue'
import Daoer from './daoer/index.vue'

export default {
  name: 'Service',
  components: {
    Duration,
    Monthly,
    CloudBox,
    Appointment,
    Daoer
  },
  data() {
    return {
      activeName: 'second'
    }
  },
  mounted() {
    if(location.hash.split("#")[2] != null){
      this.activeName = location.hash.split("#")[2]
    }
  },
  methods: {
    // 点击每个个页签时重新加载数据展示列表
    handleClick(tab, event) {
     location.hash = this.$route.path + "#" + tab.name;
    }
  }
}
</script>

<style scoped>
  .service {
    padding: 10px 20px;
    height: 100%;
    width: 100%;
    position: absolute;
  }
  /deep/ .el-tabs__content{
    height: calc(100% - 50px);;
  }
</style>
